
open Std
open Printf
open String
open Avlmap;;

module StringMap = Avlmap.Make (String);;

let cond x =
  printf "testing %s\n" x;
  x <> "v5"

let main () =
  let em0 = StringMap.empty in
  let em1 = StringMap.add "c" "v3" em0 in
  let em2 = StringMap.add "b" "v2" em1 in
  let em3 = StringMap.add "a" "v1" em2 in
  let em4 = StringMap.add "e" "v5" em3 in
  let em5 = StringMap.add "d" "v4" em4 in
  let em6 = StringMap.add "f" "v6" em5 in
  let em7 = StringMap.add "g" "v7" em6 in
  let em8 = StringMap.add "h" "v8" em7 in
  let em9 = StringMap.add "i" "v9" em8 in
  let em10 = StringMap.add "j" "v10" em9 in
  let rv = StringMap.find "d" em7 in
  let r0 = StringMap.find_segment 2 "0" em9 in
  let r1 = StringMap.find_segment 2 "ad" em9 in
  let r2 = StringMap.find_segment 2 "bd" em9 in
  let r3 = StringMap.find_segment 2 "cd" em9 in
  let r4 = StringMap.find_segment 2 "dd" em9 in
  let r5 = StringMap.find_segment 2 "ed" em9 in
  let r6 = StringMap.find_segment 2 "fd" em9 in 
  let r7 = StringMap.find_segment 2 "gd" em9 in 
  let r8 = StringMap.find_segment 2 "hd" em9 in
  let r9 = StringMap.find_segment 2 "id" em9 in 
  let rc1 = StringMap.find_condition 2 cond "d" em10 in
  printf "Find Result %s\n" rv;
  printf "FindSeq Result %s\n" (String.concat " " r0);
  printf "FindSeq Result %s\n" (String.concat " " r1);
  printf "FindSeq Result %s\n" (String.concat " " r2);
  printf "FindSeq Result %s\n" (String.concat " " r3);
  printf "FindSeq Result %s\n" (String.concat " " r4);
  printf "FindSeq Result %s\n" (String.concat " " r5);
  printf "FindSeq Result %s\n" (String.concat " " r6); 
  printf "FindSeq Result %s\n" (String.concat " " r7); 
  printf "FindSeq Result %s\n" (String.concat " " r8);
  printf "FindSeq Result %s\n" (String.concat " " r9);
  printf "FindCond Result %s\n" (String.concat " " rc1);
;;

main () ;; 
